<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Order Confirmation</title>
<style type="text/css">
/* <![CDATA[ */
table, td
{
    border-color: #666;
    border-style: solid;
}
table, th
{
    border-color: #666;
    border-style: solid;
}

table
{
    border-width: 0 0 1px 1px;
    border-spacing: 0;
    border-collapse: collapse;
}
 
td
{
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
}
th
{
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
}
/* ]]> */


</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

<script language="javascript">
function enab(){
	document.getElementById('btn_confirm_stocktake').disabled = false;
	}
</script>
</head>
<body  style="font-family:Arial, Helvetica, sans-serif">
<h1>Please verify the Qty of following repair parts:</h1>
<h4>
<ul>
  <li>Scan Or Type in Parts Barcode</li>
  <li>Currently There is no auto saving function, please do not close this page before complete</li>
</ul>
</h4>
<?php if($this->finish != true){	?>
<form id="form1" name="form1" method="post" action="">
<table width="500" border="0" cellspacing="1" cellpadding="0">

  <tr>
    <th bgcolor="#00FF00" scope="col">Qty Correct</th>
    <th bgcolor="#FF8080" scope="col"> No Stock</th>
    <th bgcolor="#FFFF00" scope="col">Incorrect</th>

  </tr>
</table>

<h3>Please fill in Actual Qty And Click 'Check Difference'</h3>
<script language="javascript">
    document.getElementById('part_code').focus(); 
    </script> 
<br />
<table width="1050" border="0" cellspacing="1" cellpadding="0">

    <tr>
    <th >Id</th>
    <th >Code</th>
    <th style="width:300px;" >Description</th>
    <th colspan = "2" style="width:100px;" >System</th>
    <th style="width:200px;" >Actual</th>
    <th style="width:100px;" >Difference</th>
    <th style="width:100px;" >SubTotal</th>
    </tr>
<?php 
	$rProduct = new Model_DbTable_Pr_Prproducts();
	$arrParts = $this->arrParts;


if(!empty($this->list)){	
foreach($this->list as $key => $list){	
		
	
 	if($key == $this->check){
 	
 	if($key == 'PARTS'){?> 
	<tr>
		<th colspan = "7" >Below List Are None Screen Parts</th>
	</tr>
	<?php }?>
	<?php if($key == 'SCREEN'){?>
 		<tr>
			<th colspan = "7" >Below List Are Screen Parts</th>
		</tr>
 	<?php }?>
	<?php foreach ($list as $k => $v){?>
  <tr 
 <?php
 
 	$actQty = (isset($arrParts[$v['info']['id_product']]))?$arrParts[$v['info']['id_product']]:'0';
	$diff =  $actQty - $v['stock']; 
	
	if($diff == 0){
			echo 'style="background-color:#00FF00;"';		
	}
	if($diff!=0 && $actQty !=0){
		
		echo 'style="background-color:#FFFF00;"';	
	}
	if($diff!=0 && $actQty ==0){
		
		echo 'style="background-color:#FF8080;"';
	}	
 ?> 
 >	
 	<td><?php echo $v['info']['id_product']?></td>
    <td><?php echo $v['info']['code_product']?></td>
    <td><span style="font-size:12px;"><?php echo $v['info']['title_product']?></span></td>
    <td><?php echo $v['stock']?> [-<?php echo $v['qty_unactive']?>]</td>
    <td><?php echo ($v['stock']-$v['qty_unactive'])?></td>
    <td align="center">
    <input name="qty_onhand_cf[<?php echo $v['info']['id_product']?>]" type="text" value="<?php echo $actQty ?>" style="width:60px;" /></td>
    <td><input type = "text" name = "qty_diff[<?php echo $v['info']['id_product']?>]" value = "<?php echo $actQty - $v['stock'];?>" readonly></input></td>
    <td>&nbsp;</td>
  </tr>
 <?php }}}}?> 
 <tr>
 	<td colspan ="7" align = "center" ><input type = "submit" name = "checkdiff" id = "checkdiff" value = "Check Difference"></input></td>
 </tr>	

<tr>
  <td style="padding:20px; text-align:center;" colspan="7"><input type="checkbox" name="scan_finished" id="scan_finished" onchange="enab()" />
    <label for="scan_finished"></label>
    I have finished scanning all  parts in the List
    <br />
    <br />
    Your Attendance Password :
    <label for="pwd"></label>
    <input type="password" name="pwd" id="pwd" />
    <br />
    <br />  
 
    <input type="submit" name="btn_confirm_stocktake" id="btn_confirm_stocktake" disabled value="Confirm Stock Take  Qty"/>
  
  
  
  
    <br />
    <br />
    * After the button Clicked, You Acknowledge you take fully responsibility of the stock take result, If the<br />
    Qty you count is inaccurate, your manager will have to re-do the stock take, so please make sure<br />
    you count all what you have.</td>
</tr>

</table>
</form>
<?php }else{?>

<h3>Warehouse Stock Take Done , Now you can close the page</h3>
<?php }?>
</body>

</html>